Typical Stages of a Remote Control Program    Related Topics

A typical remote control program comprises the following stages:  

1. Performing the basic instrument settings

2. Adjusting the test setup

3. Initiating the measurement, command synchronization

4. Retrieving the measurement results

 

Very often, steps 3 and 4 (or steps 2 to 4) must be repeated several times.   

All example programs in this section have been developed and tested by means of the GPIB Explorer provided with the network analyzer. No extra programming environment is needed.


Basic Instrument Settings

Programming task: Adjust the basic network analyzer settings to your measurement tasks, optimizing the instrument for fast measurements.  

Considerations for high measurement speed

The measurement speed depends on the sweep time but also on an efficient preparation of the instrument and on proper command synchronization. The following items should be kept in mind:

// Reset the instrument, switch off the measurement (after one sweep),

// reduce the number of sweep points.

*RST

INITiate1:CONTinuous OFF

SENSe1:SWEep:POINts 2

//

// Avoid a delay time between different partial measurements and before the start of the sweeps (is default setting).

SENSe1:SWEep:TIME:AUTO ON

TRIGger1:SEQuence:SOURce IMMediate

//

// Select the widest bandwidth compatible with your measurement.

SENSe1:BANDwidth:RESolution 10  

//

// Adjust your sweep points to your measurement task, e.g. using a segmented sweep.

SENSe1:SEGMent...  


Adjusting the Test Setup

In general the preparatives described above can be used for a series of measurements. In-between the measurements it is often necessary to change the test setup, e.g. in order to replace the DUT, change the connected ports, connect external devices etc.  


Start of the Measurement and Command Synchronization

Programming task: Start a measurement in single sweep mode. Wait until all single sweep data has been acquired before you proceed to the next stage of the measurement.  

INITiate<Ch>[:IMMediate] is used to start a single sweep or a group of single sweeps. This command has been implemented for overlapped execution. The advantage of an overlapped command is that they allow the program to do other tasks while being executed.

In the present example the sweep must be completed before measurement results can be retrieved. To prevent wrong results (e.g. a mix-up of results from consecutive sweeps) the controller must synchronize its operation to the execution of INITiate<Ch>[:IMMediate]. IEEE 488.2 defines three common commands (*WAI, *OPC?, *OPC) for synchronization.

//

// 1. Start single sweep, use *WAI

// *WAI is the easiest method of synchronization. It has no effect when sent after sequential commands.

// If *WAI follows INITiate<Ch>[:IMMediate] (overlapped command),

// the analyzer executes no further commands or queries until the sweep is terminated.

// *WAI does prevent the controller from sending other commands to the analyzer or other devices

// on the GPIB bus

INITiate1:SCOPe SINGle  //  Single sweep will be started in the referenced channel only

INITiate1:IMMediate; *WAI  //  Start single sweep in channel no. 1, wait until the end of the sweep

<Continue program sequence>

//

// 2. Start single sweep, use *OPC?

// If *OPC follows INITiate<Ch>[:IMMediate], it places a 1 into the output queue when the sweep is terminated.

// An appropriate condition in the remote control program must cause the controller to wait until *OPC? returns one.

// The controller is stopped from the moment when the condition is set.

INITiate1:IMMediate; *OPC?  //  Start single sweep in channel no. 1, indicate the end of the sweep by a 1 in the output queue.

// So far the controller may still send messages to other devices on the GPIB bus.

<Condition OPC=1>  //   Stop the controller until *OPC? returns one (program syntax depends on your programming environment).

<Continue program sequence>

//

// 3. Start single sweep, use *OPC

// If *OPC follows INITiate<Ch>[:IMMediate], it sets the OPC bit in the ESR after the sweep is terminated.  

// This event can be polled or used to trigger a service request of the analyzer.

// The advantage of *OPC synchronization is that both the controller and the analyzer can continue

// processing commands while the sweep is in progress.

*SRE 32  / Enable a service request for the ESR

*ESE 1  / Set event enable bit for operation complete bit

INITiate1::IMMediate; *OPC  //  Start single sweep in channel no. 1, set the OPC bit in the ESR after the sweep is terminated.

// The controller may still send messages, the analyzer continues to parse and execute commands.

<Wait for service request>  //   Controller waits for service request from the analyzer (program syntax depends on your programming environment).

<Continue program sequence>


Retrieving Measurement Results

Programming task: Read the results acquired in a single sweep.

//

// 1. Read single values (-> Markers)  

// Markers are the most convenient tool for determining and retrieving single values on traces.

// The analyzer provides up to ten markers; see Markers and Limit Lines.

//

// 2. Read complete trace  

// Select a trace format and read formatted trace data.

CALCulate1:FORMat MLINear  / Calculate the linear magnitude of z

CALCulate1:DATA FDATa  / Read the formatted trace data

//

Use CALCulate<Chn>:DATA:NSWeep to retrieve a particular trace within a group of sweeps.